package com.cya.lotterysystem.service.mq;

import com.cya.lotterysystem.service.dto.PageListDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

import static com.cya.lotterysystem.common.config.DirectRabbitConfig.*;

/**
 * @author ：陈奕安（3048279304@qq.com）
 * @date ：Created in 2025/11/11 20:05
 * @description：
 * @modified By：
 * @version:
 */
@Component
@Slf4j
@RabbitListener(queues = DLX_QUEUE_NAME)
public class DlxMqReceiver {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RabbitHandler
    public void process(Map<String,String> message) throws Exception{

        //死信队列处理方法

        log.info("开始处理异常消息！");
        rabbitTemplate.convertAndSend(EXCHANGE_NAME,ROUTING,message);

    }
}